package com.leye.Kbox;



import java.util.ArrayList;

import org.apache.log4j.Logger;

import com.google.gson.Gson;

import advice.ExceptionManager;
import database.DBService;
import database.pojo.MachineInfo;
import database.pojo.UserInfo;
import io.netty.handler.codec.LengthFieldBasedFrameDecoder;
import manager.connection.ClientConnectionManager;
import manager.http.HttpServer;
import manager.pay.GetPayResult;
import manager.player.PlayerManager;
import manager.rank.InsertToRedis;
import manager.songlist.Songlist;
import net.socket.server.SocketServer;
import net.socket.server.protocal.PROTOID;
import util.MyFactory;
import util.RedisUtilKS;



public class App 
{

	private static Logger logger = Logger.getLogger(ExceptionManager.class);
    public static void main( String[] args )
    {
		try {
			
		
			init();
			
			
			
			logger.info("lestudio server started");
	    	while (true) {
	    		Thread.sleep(1000000);
			}	
		} catch (Exception e) {
			e.printStackTrace();
		}
    }
    
    public static void init() throws Exception{
  
		ClientConnectionManager ccm = MyFactory.context.getBean("ClientConnectionManager", ClientConnectionManager.class);
		ccm.init();
	
    	SocketServer server2 = MyFactory.context.getBean("SocketServer", SocketServer.class);
		server2.start();
		logger.info("LestudioServer started");
		
		
		HttpServer s1 =MyFactory.context.getBean("HttpServer",HttpServer.class);
    	s1.start();
    	
    	
		GetPayResult GPR = MyFactory.context.getBean("GetPayResult", GetPayResult.class);
		GPR.init();
    	
		PlayerManager pm = MyFactory.context.getBean("PlayerManager", PlayerManager.class);
		pm.init();
		
    	logger.info("httpServer started");
    	System.out.println("httpServer started");
		
		System.out.println("server started2");	
    }
    
}